package research.ui.editors.tableeditors.sample;

import org.eclipse.jface.viewers.ITableLabelProvider;
import research.domain.ParameterValue;
import research.ui.editors.tableeditors.EntityLabelProvider;

public class SampleLabelProvider 
	extends EntityLabelProvider
	implements ITableLabelProvider {
	
	SampleTableEditor editor = null;
	
	public SampleLabelProvider(SampleTableEditor editor) {
		super();
		this.editor = editor;
	}

	@Override
	public String getColumnText(Object element, int columnIndex) {
		String result = "";
		ParameterValue par = (ParameterValue) element;
		switch (columnIndex) {
			case 0:
				result = par.getParameter().getName();
				break;
			case 1:
				result = par.getParameter().getUnits();
				break;
			case 2:
				result =  render(par.getValue());
				break;
			case 3:
				result = editor.getDefaultParameterValue(par.getParameter());
				break;
			case 4:
				result = render(par.getParameter().getLow());
				break;
			case 5:
				result = render(par.getParameter().getHigh());
				break;
			default :
				break; 	
		}
		return result;
	}
}
